﻿' •————————————————————————————————————————————————————————————————————————————————————————————————————————————•
' |                                                                                                            |
' |    GeoLock is a proof of concept (PoC). GeoLock uses Geosense for Windows,                                 |
' |    Microsoft Windows 7 Sensor and Location Interop Sample Library, Microsoft WindowsAPICodePack            |
' |    and Microsoft Bing Maps SDK to demonstrate how to retrieve geolocation data without                     |
' |    Global Positioning System (GPS) hardware.                                                               |
' |                                                                                                            |
' |    The GeoLocK application was written in VB.NET (WPF). The COM Interop Windows7.SensorAndLocation.dll,    |
' |    Microsoft.WindowsAPICodePack.dll and Microsoft.Maps.MapControl.WPF.dll supplied                         |
' |    with this application are x86 binaries.                                                                 |
' |                                                                                                            |
' |    Copyright (C) 2012 Pascal Hubert aka Néo <http://geolock.codeplex.com/>                                 |
' |                                                                                                            |
' |    Project administrator : Pascal Hubert aka Néo (neojudgment@hotmail.com)                                 |
' |                                                                                                            |
' |    This program is under Microsoft Public License (Ms-PL)                                                  |
' |                                                                                                            |
' |    You should have received a copy of the Microsoft Public License (Ms-PL)                                 |
' |    along with this program.  If not, see <http://msdn.microsoft.com/en-us/library/ff647936.aspx>.          |
' |                                                                                                            |
' •————————————————————————————————————————————————————————————————————————————————————————————————————————————•
Imports System.Threading

Public Class Application
    Private _mutex As Mutex

    Private Sub ApplicationExit(sender As Object, e As ExitEventArgs) Handles Me.Exit

        _mutex.Close()
    End Sub

    Private Sub ApplicationStartup(sender As Object, e As StartupEventArgs) Handles Me.Startup

        _mutex = New Mutex(False, "GEOLOCK_MUTEX")
        If Not _mutex.WaitOne(0, False) Then
            _mutex.Close()
            End
        End If
    End Sub
End Class
